<style>
    .header-btn {
        float: right;
        margin-top: 10px;
    }

    #LAY_page_other [readonly] {
        background-color: #f9f9f9;
        border-color: #eee !important;
    }
</style>
<!-- 正文开始 -->
<div class="layui-fluid" id="LAY_page_other">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-xs12 layui-col-sm6">
            <div class="layui-card">
                <div class="layui-card-header">二维码
                    <button id="demoQRCodeBtnChange" class="layui-btn layui-btn-xs header-btn">更换内容</button>
                </div>
                <div class="layui-card-body text-center" style="white-space: nowrap;overflow: hidden;">
                    <div id="demoQRCode" class="layui-inline" style="margin-right: 15px;"></div>
                    <div id="demoQRCode2" class="layui-inline" style="margin-right: 15px;"></div>
                    <div id="demoQRCode3" class="layui-inline layui-hide-xs" style="margin-right: 15px;"></div>
                </div>
            </div>
        </div>
        <div class="layui-col-xs12 layui-col-sm6">
            <div class="layui-card">
                <div class="layui-card-header">动画数字
                    <button id="demoAnimNumBtn" class="layui-btn layui-btn-xs header-btn">开始动画</button>
                </div>
                <div class="layui-card-body" style="padding-left: 25px;">
                    <h2 id="demoAnimNum1" style="margin: 5px 0 12px 0;">12345</h2>
                    <h2 id="demoAnimNum2" style="margin-bottom: 12px;">￥2373467.342353</h2>
                    <h2 id="demoAnimNum3" style="margin-bottom: 5px;">上浮99.98%</h2>
                </div>
            </div>
        </div>
        <div class="layui-col-xs12 layui-col-sm6">
            <div class="layui-card">
                <div class="layui-card-header">经纬度转换
                    <button id="demoJWDZHBtn" class="layui-btn layui-btn-xs header-btn">转换</button>
                </div>
                <div class="layui-card-body" style="padding-right: 70px;">
                    <div class="layui-form layui-row" id="demoJWDZH">
                        <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">高德坐标:</label>
                                <div class="layui-input-block">
                                    <input type="text" value="114.40043,30.505674" class="layui-input" readonly/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">百度坐标:</label>
                                <div class="layui-input-block">
                                    <input type="text" class="layui-input" readonly/>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">百度坐标:</label>
                                <div class="layui-input-block">
                                    <input type="text" value="114.405701,30.512004" class="layui-input" readonly/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">高德坐标:</label>
                                <div class="layui-input-block">
                                    <input type="text" class="layui-input" readonly/>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-col-xs12 layui-col-sm6">
            <div class="layui-card">
                <div class="layui-card-header">获取浏览器宽高</div>
                <div class="layui-card-body" style="padding: 44px 0 44px 25px;">
                    <button id="demoBtnGetPageWidth" class="layui-btn">获取浏览器宽度</button>
                    <button id="demoBtnGetPageHeight" class="layui-btn">获取浏览器高度</button>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- js部分 -->
<script>
    layui.use(['layer', 'admin', 'QRCode'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var admin = layui.admin;
        var QRCode = layui.QRCode;

        // 二维码
        var demoQrCode = new QRCode(document.getElementById("demoQRCode"), {
            text: "http://easyweb.vip",
            width: 106,
            height: 106,
            colorDark: "#000000",
            colorLight: "#ffffff",
            correctLevel: QRCode.CorrectLevel.H
        });
        var demoQrCode2 = new QRCode(document.getElementById("demoQRCode2"), {
            text: "http://easyweb.vip",
            width: 106,
            height: 106,
            colorDark: "#FFA800",
            colorLight: "#ffffff",
            correctLevel: QRCode.CorrectLevel.H
        });
        var demoQrCode3 = new QRCode(document.getElementById("demoQRCode3"), {
            text: "http://easyweb.vip",
            width: 106,
            height: 106,
            colorDark: "#10B4E8",
            colorLight: "#ffffff",
            correctLevel: QRCode.CorrectLevel.H
        });

        // 更换二维码内容
        $('#demoQRCodeBtnChange').click(function () {
            demoQrCode.makeCode("http://easyweb.vip?v=" + Math.floor(Math.random() * 10));
            demoQrCode2.makeCode("http://easyweb.vip?v=" + Math.floor(Math.random() * 10));
            demoQrCode3.makeCode("http://easyweb.vip?v=" + Math.floor(Math.random() * 10));
        });

        // 动画数字
        $('#demoAnimNumBtn').click(function () {
            admin.util.animateNum('#demoAnimNum1');
            admin.util.animateNum('#demoAnimNum2');
            admin.util.animateNum('#demoAnimNum3');
            $(this).hide();
            setTimeout(function () {
                $('#demoAnimNumBtn').show();
            }, 500);
        });

        // 经纬度转换
        $('#demoJWDZHBtn').click(function () {
            // 高德转百度
            var v1 = $('#demoJWDZH input:eq(0)').val().split(',');
            var n1 = admin.util.Convert_GCJ02_To_BD09({lat: v1[1], lng: v1[0]});
            $('#demoJWDZH input:eq(1)').val(n1.lng + ',' + n1.lat);
            // 百度转高德
            var v2 = $('#demoJWDZH input:eq(2)').val().split(',');
            var n2 = admin.util.Convert_BD09_To_GCJ02({lat: v2[1], lng: v2[0]});
            $('#demoJWDZH input:eq(3)').val(n2.lng + ',' + n2.lat);
        });

        // 获取浏览器宽高
        $('#demoBtnGetPageWidth').click(function () {
            layer.msg('你的浏览器宽度为：' + admin.getPageWidth() + 'px', {icon: 7});
        });
        $('#demoBtnGetPageHeight').click(function () {
            layer.msg('你的浏览器高度为：' + admin.getPageHeight() + 'px', {icon: 7});
        });

    });
</script>